import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
function test(key) {
  return fetch({
      url: `${baseUrl}/positionApply/downPlan?ids=2`,
      method: 'get'
  });
}
// 获取当前系统时间
function getCurrentSystemTime(key) {
  return fetch({
      url: `${baseUrl}/common/getCurrentDate`,
      method: 'get'
  });
}
// 下载步骤1
function downloadGetKey(key) {
  return fetch({
      url: `${baseUrl}/competitionExport/result/${key}`,
      method: 'get'
  });
}
// 下载步骤2
function downloadGetPath(params) {
  return fetch({
      url: baseUrl + '/competitionExport/file?file=' + params.file + '&name=' + params.name,
      method: 'get'
  });
}
// 根据学院查询相关专业
function getMajorByCollage(data) {
  return fetch({
      url: baseUrl + "/common/getDegreeByCollege",
      method: 'post',
      data
  });
}
// 查找id
function  getSession () {
  return fetch({
      url: baseUrl + "/common/getSession",
      method: 'get'
  });
}
// 普通话等级考试--创建考试--分页列表接口
function getPutonghuaExamsList(data) {
  return fetch({
      url: baseUrl + "/examCompetition/getListPage",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--新增创建考试接口
function addPutonghuaExam(data) {
  return fetch({
      url: baseUrl + "/examCompetition/save",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--新增创建考试接口v2
function addPutonghuaExamNew(data) {
  return fetch({
      url: baseUrl + "/examCompetition/exam/save",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--删除考试接口
function removePutonghuaExam(data) {
  return fetch({
      url: baseUrl + "/examCompetition/remove",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--查询考试明细接口
function selectPutonghuaExamDetail(params) {
  return fetch({
      url: baseUrl + "/examCompetition/getById?id=" + params.id,
      method: 'get'
  });
}
// 普通话等级考试--创建考试--考试开启或关闭
function openOrOffPutonghuaExam(data) {
  return fetch({
      url: baseUrl + "/examCompetition/onOff",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--修改考试接口
function modifyPutonghuaExam(data) {
  return fetch({
      url: baseUrl + "/examCompetition/modify",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--修改考试接口v2
function modifyPutonghuaExamNew(data) {
  return fetch({
      url: baseUrl + "/examCompetition/exam/modify",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--查询报名名单（已设置）V2
function selectRegistRosterNew(data) {
  return fetch({
      url: baseUrl + "/signUp/setting/getListPage",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--查询报名名单（已设置）筛选列表分页查询接口
function selectRegistRoster(data) {
  return fetch({
      url: baseUrl + "/signUpTemp/getListPage",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--获取设置名单key值
function getRegistRosterKey(params) {
  return fetch({
    url: baseUrl + "/signUpTemp/getKeyId?examCategory=" + params.examCategory,
    method: 'get'
  });
}
// 普通话等级考试--创建考试--删除报名名单
function deleteRegistRoster(params) {
  return fetch({
    url: baseUrl + "/signUpTemp/remove?id=" + params.id,
    method: 'get'
  });
}
// 普通话等级考试--创建考试--保存报名名单
function saveRegistRoster(data) {
  return fetch({
      url: baseUrl + "/signUpTemp/save",
      method: 'post',
      data
  });
}
// 普通话等级考试--创建考试--查询学生名单
function selectStudentRoster(data) {
  return fetch({
      url: baseUrl + "/examCommon/getStudentInfoListPage",
      method: 'post',
      data
  });
}
// 普通话等级考试--成绩管理
function getChinesePage(data) {
  return fetch({
      url: baseUrl + "/standChinese/getChinesePage",
      method: 'post',
      data
  });
}
// 普通话等级考试--成绩管理导入
function getimportScore(data) {
  return fetch({
      url: baseUrl + "/standChinese/importScore",
      method: 'post',
      data
  });
}
// 查询学生报名列表
function  postListPage (data) {
  return fetch({
      // url: baseUrl + "/signUp/getListPage",
      url: baseUrl + "/signUp/getStuCnSpeakExamPage",
      method: 'post',
      data
  });
}
// 报名/取消报名
function  postUpdate (data) {
  return fetch({
      url: baseUrl + "/signUp/update",
      method: 'post',
      data
  });
}
// 计算机报名/取消报名
function computerPostUpdate (data) {
  return fetch({
      url: baseUrl + "/signUp/roleUpdate",
      method: 'post',
      data
  });
}
// 查询学院报名统计列表
function  getListPageStatistics (data) {
  return fetch({
      url: baseUrl + "/signUp/college/getListPage",
      method: 'post',
      data
  });
}
// 设置考试时间
function  postListPageSetTime (data) {
  return fetch({
      url: baseUrl + "/signUp/setCollegeSignUpTime",
      method: 'post',
      data
  });
}
// 学院报名统计导出
function  exportCollegeStatistic (data) {
  return fetch({
    url: baseUrl + "/signUp/exportCollegeStatistic",
    method: 'post',
    responseType: 'blob',
    data
  }).then(res => {
    UTILS.downloadFile(res, '学院报名统计.xls', 'application/vnd.ms-excel;charset=utf-8');
  });
}
// 查询学生报名列表
function  poststudentRegistraList (data) {
  return fetch({
      url: baseUrl + "/signUp/student/getListPage",
      method: 'post',
      data
  });
}
// 查询学生报名列表导出
function  poststudentExport (data) {
  return fetch({
      url: baseUrl + "/signUp/export",
      method: 'post',
      data
  });
}
// 查询学生报名列表导出
function  poststudentNoSignExport (data) {
  return fetch({
      url: baseUrl + "/signUp/exportNotSign",
      method: 'post',
      data
  });
}
// 计算机等级考试--创建考试--新版创建
function computerCreateExam (data) {
  return fetch({
      url: baseUrl + "/computerExam/exam/save",
      method: 'post',
      data
  });
}
// 计算机等级考试--创建考试--新版修改
function computerModifyExam (data) {
  return fetch({
      url: baseUrl + "/computerExam/exam/modify",
      method: 'post',
      data
  });
}
// 计算机等级考试--名单规则设置--添加学生
function ruleListSetAddStu (data) {
  return fetch({
      url: baseUrl + "/signUpSupplement/addStudents",
      method: 'post',
      data
  });
}
// 计算机等级考试--名单规则设置--删除学生
function ruleListSetDelStu (data) {
  return fetch({
      url: baseUrl + "/signUpSupplement/deleteStudents",
      method: 'post',
      data
  });
}
// 计算机等级考试--名单规则设置--查看已选学生列表
function ruleListSelectedStuList (data) {
  return fetch({
      url: baseUrl + "/signUpSupplement/getSavedStudents",
      method: 'post',
      data
  });
}
// 计算机成绩管理
function  postComputerManagement (data) {
  return fetch({
      url: baseUrl + "/computerScore/getPage",
      method: 'post',
      data
  });
}
// 计算机成绩管理/导入
function  postComputerRmport (data) {
  return fetch({
      url: baseUrl + "/computerScore/import",
      method: 'post',
      data
  });
}
// 计算机我的成绩
function  computerMyGrades (data) {
  return fetch({
      url: baseUrl + "/signUpInfoAndMyScore/myScore/getListPage",
      method: 'post',
      data
  });
}
// 计算机等级考试--创建考试类型--创建
function computerCreateExamType (data) {
  return fetch({
      url: baseUrl + "/examCompetitionType/save",
      method: 'post',
      data
  });
}
// 计算机等级考试--创建考试类型--修改
function computerModifyExamType (data) {
  return fetch({
      url: baseUrl + "/examCompetitionType/modify",
      method: 'post',
      data
  });
}
// 计算机等级考试--创建考试类型--删除
function computerDeleteExamType (data) {
  return fetch({
      url: baseUrl + "/examCompetitionType/remove",
      method: 'post',
      data
  });
}
// 计算机等级考试--创建考试类型--开启/关闭
function computerOnOffExamType (data) {
  return fetch({
      url: baseUrl + "/examCompetitionType/onOff",
      method: 'post',
      data
  });
}
// 计算机等级考试--创建考试类型--分页
function computerExamTypeListPage (data) {
  return fetch({
      url: baseUrl + "/examCompetitionType/getListPage",
      method: 'post',
      data
  });
}
// 计算机等级考试--创建考试类型--不分页
function computerExamTypeListNoPage (data) {
  return fetch({
      url: baseUrl + "/examCompetitionType/getListAll",
      method: 'post',
      data
  });
}
// 计算机学生报名
function  computerEnrollment (data) {
  return fetch({
      url: baseUrl + "/signUp/getExamListPage",
      method: 'post',
      data
  });
}
// 计算机查询报名学生信息
function  informationEnrolled (data) {
  return fetch({
      url: baseUrl + "/signUp/role/get?competitionId="+data.competitionId + '&studentId='+data.studentId + '&cardType=' + data.cardType + '&calendarId=' + data.calendarId,
      method: 'get',
  });
}
// 计算机报名信息
function  computerSignUpInfo (data) {
  return fetch({
      url: baseUrl + "/signUpInfoAndMyScore/signUpInfo/getListPage",
      method: 'post',
      data
  });
}
// 计算机报名信息导出
function  computerSignExport (data) {
  return fetch({
      url: baseUrl + "/signUpInfoAndMyScore/template/export?campus="+data.campus+'&calendarId='+data.calendarId+'&college='+data.college+'&major='+
      data.major+'&subjectCode='+data.subjectCode+'&competitionType='+data.competitionType+'&studentIdOrName='+data.studentIdOrName+'&selectRowId='+data.selectRowId+'&examCategory='+data.examCategory,
      responseType: 'blob',
      method: 'get'
  }).then(res => {
    UTILS.downloadFile(res, '计算机报名信息导出.xls', 'application/vnd.ms-excel;charset=utf-8');
  });
}
// 黑名单管理--查看列表
function selectBlackList (data) {
  return fetch({
      url: baseUrl + "/examBlackList/getBlackList",
      method: 'post',
      data
  });
}
// 黑名单管理--下载模板
function downloadTemplate () {
  return fetch({
    url: baseUrl + "/cet/pictureTemplate",
    method: 'get',
    responseType: 'blob'
  }).then(resp => {
    if (!resp) {
      return
    }
    if (window.navigator && window.navigator.msSaveOrOpenBlob) {
      window.navigator.msSaveOrOpenBlob(new Blob([resp]), fileName)
    } else {
      let url = window.URL.createObjectURL(new Blob([resp]))
      let link = document.createElement('a')
      link.style.display = 'none'
      link.href = url
      link.setAttribute('download', fileName)
      document.body.appendChild(link)
      link.click()
    }
  })
}
// 黑名单管理--导入
function importBlackList (data) {
  return fetch({
      url: baseUrl + "/examBlackList/importBlack",
      method: 'post',
      data
  });
}
// 黑名单管理--删除
function deleteBlackList (params) {
  return fetch({
      url: baseUrl + "/examBlackList/deleteBlack?studentId=" + params.studentId + '&calendarId=' + params.calendarId + '&examCategory=' + params.examCategory + '&educationTag=' + params.educationTag,
      method: 'get'
  });
}
// 名单规则设置--获取当前学期名单规则
function getCurrentTermRuleList () {
  return fetch({
      url: baseUrl + "/examSignUpRole/getCurrentCalendarRole?examCategory=3",
      method: 'get'
  });
}
// 名单规则设置--获取当前学期名单规则--国家汉字
function getCurrentTermRuleLists () {
  return fetch({
      url: baseUrl + "/examSignUpRole/getCurrentCalendarRole?examCategory=6",
      method: 'get'
  });
}
// 名单规则设置--保存规则
function saveRuleList (data) {
  return fetch({
      url: baseUrl + "/examSignUpRole/saveRole",
      method: 'post',
      data
  });
}
// 英语四六级列表查询
function  englishListQuery (data) {
  return fetch({
      url: baseUrl + "/cet/getPicturePage",
      method: 'post',
      data
  });
}
// 英语四六级照片导出
function  postExportPicture (data) {
  return fetch({
    url: baseUrl + "/cet/exportPicture?zipUrl=" + data,
    method: 'post',
    responseType: 'blob',
    data
  }).then(res => {
    UTILS.downloadFile(res, '学籍照片.zip', 'application/vnd.ms-excel;charset=utf-8');
  });
}
// 英语四六级成绩管理列表查询
function  englishListManagementQuery (data) {
  return fetch({
      url: baseUrl + "/cet/getCetScorePage",
      method: 'post',
      data
  });
}
// 英语四六级获取笔试科目列表
function  englishListSubjectQuery () {
  return fetch({
      url: baseUrl + "/cet/getWrittenSubjects",
      method: 'get'
  });
}
// 英语四六级导入
function  englishListIntroduction (data) {
  return fetch({
      url: baseUrl + "/cet/importScore",
      method: 'post',
      data
  });
}
// 英语四六级获取报表设置
function  englishListReportSetting (data) {
  return fetch({
      url: baseUrl + "/cet/getReportSetting?educationTag=" + data,
      method: 'get'
  });
}
// 英语四六级报表设置
function  englishListsetCetConfig (data) {
  return fetch({
      url: baseUrl + "/cet/setCetConfig",
      method: 'post',
      data
  });
}
// 英语四六级我的成绩/统计
function  englishListsetStatistics (data) {
  return fetch({
      url: baseUrl + "/cet/getScoreStatistic?educationTag=" + data.educationTag + '&cetType=' + data.cetType + '&grade=' + data.grade + '&college=' + data.college+'&leaveSchool='+data.leaveSchool,
      method: 'get'
  });
}
// 英语四六级我的成绩/统计获取年
function  englishListsetStatisticsYear (data) {
  return fetch({
      url: baseUrl + "/cet/getStatisticGrades?educationTag=" + data,
      method: 'get'
  });
}
// 英语四六级我的成绩/统计获取学院
function  englishListsetStatisticsCollege (data) {
  return fetch({
      url: baseUrl + "/cet/getStatisticColleges?educationTag=" + data,
      method: 'get'
  });
}
// 英语四六级照片导入
function  englishListImportStudent (data) {
  return fetch({
      url: baseUrl + "/cet/importStudent",
      method: 'post',
      data
  });
}
// 创建考试获取年
function  getCurrentDate () {
  return fetch({
      url: baseUrl + "/examCommon/getCurrentDate",
      method: 'get'
      // data
  });
}
// 下载模板
function  getPictureTemplate () {
  return fetch({
    url: baseUrl + "/cet/pictureTemplate",
    method: 'get',
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '学生信息导入模板.xls', 'application/vnd.ms-excel;charset=utf-8');
  });
}
// 终止导入
function stopImport(data) {
  return fetch({
    url: baseUrl + "/cet/stopImport",
    method: 'post',
    data
  });
}

// 名单设置--添加学生
function addStudentRoster(data) {
  return fetch({
      url: baseUrl + "/examCompetition/cnSpeakAdd",
      method: 'post',
      data
  });
}
// 名单设置--已选名单列表
function selectedStudent(data) {
  return fetch({
      url: baseUrl + "/examCompetition/getSelectedStuPage",
      method: 'post',
      data
  });
}
// 名单设置--已选名单删除
function deleteStudent(data) {
  return fetch({
      url: baseUrl + "/examCompetition/cnSpeakDelete",
      method: 'post',
      data
  });
}

// 准考证相关设置
function ticketSet(data) {
  return fetch({
      url: baseUrl + "/exam/examCard/setCardPrint",
      method: 'post',
      data
  });
}

//准考证相关设置详情
function ticketSetDetails(examCategory) {
  return fetch({
    url: baseUrl + '/exam/examCard/getCardPrint?examCategory='+examCategory,
    method: 'get'
  });
}
// 准考证模板下载模板
function  downloadStudents () {
  return fetch({
    url: baseUrl + "/exam/examCard/getTemplate",
    method: 'get',
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '准考证模板下载.xlsx', 'application/vnd.ms-excel;charset=utf-8');
  });
}

//准考证批量打印
function  exportBatch (data) {
  return fetch({
    url: baseUrl + '/exam/examCard/printBatch?competitionId='+data.competitionId+'&cardIds='+data.cardIds,
    method: 'get',
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '批量打印准考证.zip', 'application/vnd.ms-excel;charset=utf-8');
  });
}

/**
 * 获取key
 */
 function exportStatusObs(key) {
  return fetch({
    url: '/api/electionservice/undergraduateExamDownload/resultObs/' + key,
    method: 'get'
  });
}


//准考证相关信息
function printingDetails(data) {
  return fetch({
    url: baseUrl + '/exam/examCard/getPrintInfo?signUpId='+data.signUpId,
    method: 'get'
  });
}


export default {
    'test': test,
    'getCurrentSystemTime': getCurrentSystemTime,
    'getSession': getSession,
    'downloadGetKey': downloadGetKey,
    'downloadGetPath': downloadGetPath,
    'getMajorByCollage': getMajorByCollage,
    'getPutonghuaExamsList': getPutonghuaExamsList,
    'addPutonghuaExam': addPutonghuaExam,
    'addPutonghuaExamNew': addPutonghuaExamNew,
    'removePutonghuaExam': removePutonghuaExam,
    'selectPutonghuaExamDetail': selectPutonghuaExamDetail,
    'openOrOffPutonghuaExam': openOrOffPutonghuaExam,
    'modifyPutonghuaExam': modifyPutonghuaExam,
    'modifyPutonghuaExamNew': modifyPutonghuaExamNew,
    'selectRegistRosterNew': selectRegistRosterNew,
    'selectRegistRoster': selectRegistRoster,
    'getRegistRosterKey': getRegistRosterKey,
    'deleteRegistRoster': deleteRegistRoster,
    'saveRegistRoster': saveRegistRoster,
    'selectStudentRoster': selectStudentRoster,
    'postListPage': postListPage,
    'postUpdate': postUpdate,
    'computerPostUpdate': computerPostUpdate,
    'getListPageStatistics': getListPageStatistics,
    'postListPageSetTime': postListPageSetTime,
    'exportCollegeStatistic': exportCollegeStatistic,
    'poststudentRegistraList': poststudentRegistraList,
    'poststudentExport': poststudentExport,
    'poststudentNoSignExport': poststudentNoSignExport,
    'computerCreateExam': computerCreateExam,
    'computerModifyExam': computerModifyExam,
    'ruleListSetAddStu': ruleListSetAddStu,
    'ruleListSetDelStu': ruleListSetDelStu,
    'ruleListSelectedStuList': ruleListSelectedStuList,
    'postComputerManagement': postComputerManagement,
    'postComputerRmport': postComputerRmport,
    'computerMyGrades': computerMyGrades,
    'computerCreateExamType': computerCreateExamType,
    'computerModifyExamType': computerModifyExamType,
    'computerDeleteExamType': computerDeleteExamType,
    'computerOnOffExamType': computerOnOffExamType,
    'computerExamTypeListPage': computerExamTypeListPage,
    'computerExamTypeListNoPage': computerExamTypeListNoPage,
    'computerEnrollment': computerEnrollment,
    'informationEnrolled': informationEnrolled,
    'getChinesePage': getChinesePage,
    'getimportScore': getimportScore,
    'computerSignUpInfo': computerSignUpInfo,
    'computerSignExport': computerSignExport,
    'selectBlackList': selectBlackList,
    'importBlackList': importBlackList,
    'downloadTemplate': downloadTemplate,
    'deleteBlackList': deleteBlackList,
    'getCurrentTermRuleList': getCurrentTermRuleList,
    'saveRuleList': saveRuleList,
    'englishListQuery': englishListQuery,
    'postExportPicture': postExportPicture,
    'englishListManagementQuery': englishListManagementQuery,
    'englishListSubjectQuery': englishListSubjectQuery,
    'englishListIntroduction': englishListIntroduction,
    'englishListReportSetting': englishListReportSetting,
    'englishListsetCetConfig': englishListsetCetConfig,
    'englishListsetStatistics': englishListsetStatistics,
    'englishListsetStatisticsYear': englishListsetStatisticsYear,
    'englishListsetStatisticsCollege': englishListsetStatisticsCollege,
    'englishListImportStudent': englishListImportStudent,
    'getCurrentDate': getCurrentDate,
    'getPictureTemplate': getPictureTemplate,
    'stopImport': stopImport,
    'addStudentRoster':addStudentRoster,
    'selectedStudent':selectedStudent,
    'deleteStudent':deleteStudent,
    'ticketSet':ticketSet,
    'ticketSetDetails':ticketSetDetails,
    'downloadStudents':downloadStudents,
    'exportBatch':exportBatch,
    'printingDetails':printingDetails,
    'exportStatusObs':exportStatusObs,
    'getCurrentTermRuleLists': getCurrentTermRuleLists,
};

